package com.liyou.wechat.controller;

import com.liyou.common.result.Result;
import com.liyou.vo.wechat.MenuVo;
import com.liyou.wechat.service.WechatMenuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/wechat/menu")
public class WechatMenuController {

    @Autowired
    private WechatMenuService wechatMenuService;

    @ApiOperation(value ="获取全部菜单")
    @GetMapping("findMenuInfo")
    public Result findMenuInfo() {
        List<MenuVo> menuList = wechatMenuService.findMenuInfo();
        return Result.ok(menuList);
    }

    @ApiOperation(value="同步菜单")
    @GetMapping("syncMenu")
    public Result createMenu() {
        wechatMenuService.syncMenu();
        return Result.ok();
    }

    @ApiOperation(value = "删除菜单")
    @DeleteMapping("removeMenu")
    public Result removeMenu() {
        wechatMenuService.removeMenu();
        return Result.ok();
    }
}
